
/*
 * Copyright 2002-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2017原作者。
 *
 *根据Apache许可证2.0版许可（“许可证”）；
 *除非符合许可证的规定，否则您不得使用此文件。
 *您可以在以下网址获取许可证副本：
 *
 *https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证进行的分发是在“按原样”的基础上进行的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限的特定语言，请参阅许可证和
 *许可证下的限制。
 */

package org.springframework.stereotype;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicate that the annotated element represents a stereotype for the index.
 *
 * <p>The {@code CandidateComponentsIndex} is an alternative to classpath
 * scanning that uses a metadata file generated at compilation time. The
 * index allows retrieving the candidate components (i.e. fully qualified
 * name) based on a stereotype. This annotation instructs the generator to
 * index the element on which the annotated element is present or if it
 * implements or extends from the annotated element. The stereotype is the
 * fully qualified name of the annotated element.
 *
 * <p>Consider the default {@link Component} annotation that is meta-annotated
 * with this annotation. If a component is annotated with {@link Component},
 * an entry for that component will be added to the index using the
 * {@code org.springframework.stereotype.Component} stereotype.
 *
 * <p>This annotation is also honored on meta-annotations. Consider this
 * custom annotation:
 * <pre class="code">
 * package com.example;
 *
 * &#064;Target(ElementType.TYPE)
 * &#064;Retention(RetentionPolicy.RUNTIME)
 * &#064;Documented
 * &#064;Indexed
 * &#064;Service
 * public @interface PrivilegedService { ... }
 * </pre>
 *
 * If the above annotation is present on a type, it will be indexed with two
 * stereotypes: {@code org.springframework.stereotype.Component} and
 * {@code com.example.PrivilegedService}. While {@link Service} isn't directly
 * annotated with {@code Indexed}, it is meta-annotated with {@link Component}.
 *
 * <p>It is also possible to index all implementations of a certain interface or
 * all the subclasses of a given class by adding {@code @Indexed} on it.
 *
 * Consider this base interface:
 * <pre class="code">
 * package com.example;
 *
 * &#064;Indexed
 * public interface AdminService { ... }
 * </pre>
 *
 * Now, consider an implementation of this {@code AdminService} somewhere:
 * <pre class="code">
 * package com.example.foo;
 *
 * import com.example.AdminService;
 *
 * public class ConfigurationAdminService implements AdminService { ... }
 * </pre>
 *
 * Because this class implements an interface that is indexed, it will be
 * automatically included with the {@code com.example.AdminService} stereotype.
 * If there are more {@code @Indexed} interfaces and/or superclasses in the
 * hierarchy, the class will map to all their stereotypes.
 *
 * @author Stephane Nicoll
 * @since 5.0
 */
/**
 *指示带注释的元素表示索引的构造型。
 *
 *<p>｛@code CandidateComponentsIndex｝是类路径的替代方案
 *使用编译时生成的元数据文件的扫描。这个
 *索引允许检索候选组件（即完全合格
 *名字）。此注释指示生成器
 *为带注释的元素所在的元素编制索引，或者如果
 *实现或从带注释的元素扩展。刻板印象是
 *带注释元素的完全限定名称。
 *
 *<p>考虑元注释的默认｛@link Component｝注释
 *带有此注释。如果用{@link component}对组件进行注释，
 *该组件的条目将使用
 *｛@codeorg.springframework.costereot.Component｝构造型。
 *
 *<p>此注释也受到元注释的尊重。考虑一下
 *自定义注释：
 *<pre-class=“code”>
 *包com.example；
 *
 *&#064；目标（ElementType.TYPE）
 *&#064；保留（保留策略.RUNTIME）
 *&#064；记录在案
 *&#064；已编制索引
 *&#064；服务
 *public@interface特权服务｛…｝
 *</pre>
 *
 *如果上面的注释出现在一个类型上，它将用两个索引
 *构造型：{@code.org.springframework.costereoty.Component}和
 *｛@code.com.example.PrivilegedService｝。而｛@link Service｝不是直接的
 *用{@code Indexed}进行注释，它是用{@link Component}进行元注释的。
 *
 *＜p＞还可以对某个接口或
 *通过在给定类的所有子类上添加{@code@Indexed}。
 *
 *考虑这个基本接口：
 *<pre-class=“code”>
 *包com.example；
 *
 *&#064；已编制索引
 *公共接口AdminService｛…｝
 *</pre>
 *
 *现在，考虑在某个地方实现这个{@codeAdminService}：
 *<pre-class=“code”>
 *包com.example.foo；
 *
 *导入com.example.AdminService；
 *
 *公共类ConfigurationAdminService实现AdminService｛…｝
 *</pre>
 *
 *因为这个类实现了一个被索引的接口，所以它将
 *自动包含在{@code.com.example.AdminService}构造型中。
 *如果在
 *层次结构，类将映射到它们的所有刻板印象。
 *
 *@作者Stephane Nicoll
 *@自5.0起
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Indexed {
}
